package com.yuyang.springcloud.entities;

import lombok.Data;

/**
 * @author yu yang
 * @date 2022/10/25 -15:18
 */
@Data
public class CommonResult<T>{
    private String message;
    private Integer code;
    private T data;
    public static <T> CommonResult<T> success(Integer code,String msg,T object) {
        CommonResult<T> result = new CommonResult<T>();
        result.message = msg;
        result.data = object;
        result.code = code;
        return result;
    }

    public static <T> CommonResult<T> error(Integer code,String msg) {
        CommonResult result = new CommonResult();
        result.message = msg;
        result.code = code;
        return result;
    }
}
